package com.itboye.hutouben.activity.qianbao;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.itboye.hutouben.R;
import com.itboye.hutouben.base.BaseActivity;
import com.itboye.hutouben.base.MyApplcation;
import com.itboye.hutouben.util.ByAlert;
import com.itboye.hutouben.util.IsUtilUid;

/**
 * 支付密码
 */
public class ZhiFuPassActivity extends BaseActivity {
    TextView add_shap_title_tv, add_lift_tv;
    ImageView close_icon;

    RelativeLayout zhifu_shezhi, zhifu_chongzhi;
    String pwdpay;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_zhi_fu_pass);
        add_shap_title_tv.setVisibility(View.GONE);
        pwdpay=IsUtilUid.isPwd();
        add_lift_tv.setText(R.string.shezhi_zhifu_pass);
    }

    @Override
    protected void onInit() {

    }

    @Override
    protected void onReadIntent(Bundle bundle) {

    }

    @Override
    public void onClick(View v) {
        Intent intent;
        switch (v.getId()) {
            case R.id.close_icon:
                finish();
                break;
            case R.id.zhifu_shezhi:// 设置支付密码
                onPwdApplcation(pwdpay);

                break;
            case R.id.zhifu_chongzhi:// 重置支付密码
                intent = new Intent(this, ZhiFuPassChongZhiActivity.class);
                startActivity(intent);
                break;

            default:
                break;
        }
    }

    public void onPwdApplcation(String pwd) {
        if (pwd == null || pwd == "") {
            Intent intent = new Intent(MyApplcation.ctx, ZhiFuPassSheZhiActivity.class);
            startActivity(intent);
            finish();
        }else{
            ByAlert.alert("支付密码已设置");
        }
    }
}
